package main

import (
	"fmt"
	"time"
)

func main() {
	ch := make(chan bool)
	go test01(ch)
	go test02(ch)

	time.Sleep(5 * time.Second)
	fmt.Println("pool01-baseuse goroutine over")
}

func test01(ch chan bool) {
	defer close(ch)
	time.Sleep(2 * time.Second)
	ch <- true
	fmt.Println("test01执行完成，send res to happensBeforeChan")
}

func test02(ch chan bool) {
	for {
		select {
		case v, ok := <-ch:
			if ok {
				fmt.Println("test02执行完成 get res:", v)
				break
			}
		}
	}

}
